<%@ page import="java.sql.*" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    if (session.getAttribute("LoginedManagementName") == null){
        request.getRequestDispatcher("LoginForm.jsp").forward(request,response);
        return;
    }
%>
<a href="index1.jsp">返回</a>
<form name='batchManageForm' action="Manage.jsp" method='post'>
<table border="1" width="100%" >
    <center>
        <tr>
            <th width="40">选择</th>
            <th width="40">序号</th>
            <th width="40">学号</th>
            <th width="40">姓名</th>
            <th width="40">性别</th>
            <th width="40">学籍状态</th>
        </tr>
        <%
            String Major = request.getParameter("major");
            String Grade = request.getParameter("grade");
            String Banji = request.getParameter("banji");
            session.setAttribute("Major", request.getParameter("major"));
            session.setAttribute("Grade", request.getParameter("grade"));
            session.setAttribute("Banji", request.getParameter("banji"));
            Class.forName("com.mysql.cj.jdbc.Driver");
            Connection con=DriverManager.getConnection(
                    "jdbc:mysql://127.0.0.1:3306/file?useSSL=FALSE&serverTimezone=UTC"
                    , "root", "123456");
            Statement st=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
                    ResultSet.CONCUR_READ_ONLY);
            ResultSet rs=st.executeQuery("select A.user_id,user_name,gender,Enrollment_Status from student A,dangan B " +
                    "where A.user_id=B.user_id and Enrollment_Status!='毕业' and major='"+Major+"'"+"and grade='"+Grade+"'"+"and banji='"+Banji+"'");
            int count=1;
            while(rs.next()){
                out.print("<tr>"+"<td><input type=checkbox name=select value='"+rs.getString("user_id")+"'"+"></td>");
                out.print("<td>"+(count++)+"</td>");
                out.print("<td>"+rs.getString("user_id")+"</td>");
                out.print("<td>"+rs.getString("user_name")+"</td>");
                out.print("<td>"+rs.getString("gender")+"</td>");
                out.print("<td>"+rs.getString("Enrollment_Status")+"</td>");
                out.print("</tr>");
            }
        %>
    </center>
    <td align="center" colspan="6"> <input type='submit' value="一键毕业" required/></td>
</table>
</form>
<%@include file="footer.jsp" %>
</body>
</html>


